//
// Created by martin on 8/3/21.
//

#ifndef FTPSERVER2_0_SOCKET_H
#define FTPSERVER2_0_SOCKET_H

#include <event2/bufferevent.h>

#define MSG_LINE_MAX           1024  /* 一行字符串最大字符数(含null终结符) */

typedef struct sockaddr SA;

int socket_create(const char *ip, int port);
int socket_client_create_bind(const char *ip, int port);
int socket_accept(int sock);
int socket_connect(const char *ip, int port);
int socket_getLocalIPAddr(char *ipbuf);

void send_reply(struct bufferevent *bev, int code, const char *text);
void send_msg(struct bufferevent *bev, const char *msg);
void send_data(struct bufferevent *bev, const char *data);

#endif //FTPSERVER2_0_SOCKET_H
